<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt'%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page
	import="org.springframework.security.core.AuthenticationException"%>
	<%@ page import="java.net.URL" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Home</title>

<script type="text/javascript"	src=${pageContext.servletContext.contextPath}/static/javascript/jquery-1.6.2.min.js></script>
<script type="text/javascript"
src=${pageContext.servletContext.contextPath}/static/javascript/jquery-ui-1.8.14.custom.min.js></script>
<script type="text/javascript"
src=${pageContext.servletContext.contextPath}/static/javascript/jquery.validate-1.5.5.min.js></script>
<script type="text/javascript"
src=${pageContext.servletContext.contextPath}/static/javascript/jquery.bgiframe-2.1.1.min.js></script>
<script type="text/javascript"
src=${pageContext.servletContext.contextPath}/static/javascript/jquery.tooltip-1.3.min.js></script>
<script type="text/javascript"
src=${pageContext.servletContext.contextPath}/static/javascript/jquery.tablednd-0.5.min.js></script>
<script type="text/javascript"
src=${pageContext.servletContext.contextPath}/static/javascript/jquery.scrollTo-1.4.2.min.js></script>
<script type="text/javascript"
src=${pageContext.servletContext.contextPath}/static/javascript/ajaxupload-3.9.js></script>
<script type="text/javascript" src=${pageContext.servletContext.contextPath}/static/javascript/scripts-1.0.js></script>
<script src=${pageContext.servletContext.contextPath}/static/javascript/jquery.lightbox-0.5.js
type="text/javascript"></script>
<link rel="icon" href=${pageContext.servletContext.contextPath}/static/gfx/favicon.ico
type="image/x-icon" />
<link rel="stylesheet" type="text/css"
href=${pageContext.servletContext.contextPath}/static/css/jquery-ui-1.8.14.custom.css />
<link rel="stylesheet" type="text/css"
href=${pageContext.servletContext.contextPath}/static/css/start-style.css />
<link rel="stylesheet" type="text/css"
href=${pageContext.servletContext.contextPath}/static/css/jquery.lightbox-0.5.css />
<title>Wypożyczlnia samochodów</title>
<script>
$(document).ready(function() {
    
    $('a.lightbox').lightBox();
    });

function ajaxFunction(p) { 
	
		// 
        $.ajax({
			url:'/ssi/offerView/reload.do',
			data: ({ page: p}),
			success:function(data){    
            // data contains the result  
            // Assign result to the sum id  
          // alert(p);
           jQuery("cars-div").remove();
             jQuery("#center").html(data);   
			}  
        });   

    return false;
}  



</script>
</head>
  <body> 
    <div id="wrapper">
      <div id="bg"> 
        <div id="header"></div>  
        <div id="page">
        	<jsp:include page="header.jsp"/>
            
            <!--  content -->  
            <div id="buttonHover">
            <div id="content" style="display:table;"> 
            
              <div id="center">
              <div id="cars-div">
                <div id="listasamochodow1">
	                <p><h2>Dostepne samochody do wypozyczenia</h2></p>
	                
	                <c:forEach items="${cars}" var="car">
	                <div>
	                	<c:forEach items="${car.photos}" var="p">
	                	<a href="image.do?id=${p.idPhoto}" class="lightbox"><img  src="image.do?id=${p.idPhoto}"  style="height:auto ;width: auto;  max-height:72px; max-width: 129px !important;" alt="" /></a>
		                </c:forEach>
		                <table>
			                <tr>
			                	<th>Producent</td><td>${car.brand}</td>
			                	<th>Model</td><td>${car.model}</td>
			                	
			                </tr>
			                <tr>
			                	<th>Rok produkcji</td><td>${car.year}</td>
			                	<th>Numer rejestracyjny</td><td>${car.registration_number}</td>
			                </tr>
			                <tr>
			                	<th>Kolor</td><td>${car.color}</td>
			                	<th>Opis</td><td>${car.description}</td>
			                </tr>
		                </table>
		                <a id="noDecoration" href="/ssi/rent/confirm.do?id=${car.id}"><input id="rentButton" type="button" value="Wypozycz"></input></a> 
		                <br /><br />
		               </div>
	                </c:forEach>
	                <c:if test="${actual>1}">
	                 	<a id="noDecoration" href="#" onclick="ajaxFunction(${actual-1});return false;"><input type="button" value="Wstecz"></input></a>
	                </c:if>
	               
	                <c:forEach items="${pages}" var="p">
	                	<c:if test="${p==actual}">
	                	<a id="noDecoration" href="#" onclick="ajaxFunction(${p});return false;"><input id="actualPageNumber" type="button" value="${p}"></input></a>
	                	</c:if>
	                	<c:if test="${p!=actual}">
	                	<a id="noDecoration" href="#" onclick="ajaxFunction(${p});return false;"><input id="pageNumber" type="button" value="${p}"></input></a>
	                	</c:if>
		                
		            </c:forEach>
		            <c:if test="${last>actual}">
		             	<a id="noDecoration" href="#" onclick="ajaxFunction(${actual+1});return false;"><input type="button" value="Dalej"></input></a>
		            </c:if>
                
                </div> 
                <div id="main_content">
                
				</div>
				</div>
              </div> 
              
              <div id="right"> 
	        		<jsp:include page="sidebar.jsp"/>
              </div> 
              <div class="clear" style="height:40px"></div> 
            </div>  
            </div>  
            <!-- end content --> 
          </div>  
          <!-- end container --> 
        </div>  
        <div id="footerWrapper"> 
          <div id="footer"> 
            <p style="padding-top:10px;"> 
              <a href="#" shape="rect">Home</a> | 
              <a href="#" shape="rect">Products</a> | 
              <a href="#" shape="rect">Services</a> | 
              <a href="#" shape="rect">News</a> | 
              <a href="#" shape="rect">About</a> 
            </p>  
            <p> 
              <!-- 
DO NOT REMOVE OR MODIFY THE FOOTER LINK BELOW.
If you want to remove this link please make a 10 dollars donation at www.dotemplate.com
-->  
              <a href="http://www.dotemplate.com" shape="rect">Templates</a> maker
            </p> 
          </div> 
        </div> 
      </div> 
  </body>
</html>
